package cn.bugio.task05;

public class GamePlayerProxy implements IGamePlayer,IProxy{
        private IGamePlayer aIGamePlayer;

        public GamePlayerProxy(IGamePlayer iGamePlayer){
            aIGamePlayer=iGamePlayer;
            if(count()){
                this.aIGamePlayer=iGamePlayer;
            }else{
                System.out.println("付钱.....");
            }

        }

    @Override
    public void killBoss() {
        aIGamePlayer.killBoss();
    }

    @Override
    public void upgrade() {
       aIGamePlayer.upgrade();
    }

    @Override
    public void login(String user, String password) {
        aIGamePlayer.login(user,password);
    }

    @Override
    public boolean count() {
        System.out.println("代理共收费10元，已付款");
        return true;
    }
}
